/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 保险服务提供商员工服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const insuranceServiceEmployeeApi = urls.insuranceServiceEmployee

function listAllRescueDriver(companyId, success, complete) {
  postRequest(insuranceServiceEmployeeApi.listAllRescueDriver + companyId, {}, {}, success, complete)
}

function listGroupRescueEmployee(param, page, pageSize, success, complete) {
  postRequest(insuranceServiceEmployeeApi.listGroupRescueEmployee + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function listManager(param, page, pageSize, success, complete) {
  postRequest(insuranceServiceEmployeeApi.listManager + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function listDriver(param, page, pageSize, success, complete) {
  postRequest(insuranceServiceEmployeeApi.listDriver + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function updateRescueCompanyManager(param, success, complete) {
  postRequest(insuranceServiceEmployeeApi.updateRescueCompanyManager, {}, param, success, complete)
}

function auditRescueCompanyManager(id, param, success, complete) {
  postRequest(insuranceServiceEmployeeApi.auditRescueCompanyManager + id, {}, param, success, complete)
}

function auditRescueCompanyDriver(id, param, success, complete) {
  postRequest(insuranceServiceEmployeeApi.auditRescueCompanyDriver + id, {}, param, success, complete)
}

function getRescueEmployeeById(id, success, complete) {
  getRequest(insuranceServiceEmployeeApi.getRescueEmployeeById + id, {}, success, complete)
}

function removeRescueEmployee(ids, success, complete) {
  postRequest(insuranceServiceEmployeeApi.removeRescueEmployee, {}, ids, success, complete)
}

function deleteSingleRescueEmployee(id, success, complete) {
  let ids = []
  ids.push(id)
  removeRescueEmployee(ids, success, complete)
}

function countAuditingInsuranceCompanyManager(success, complete) {
  getRequest(insuranceServiceEmployeeApi.countAuditingInsuranceCompanyManager, {}, success, complete)
}

export default {
  countAuditingInsuranceCompanyManager,
  listAllRescueDriver,
  listGroupRescueEmployee,
  listManager,
  listDriver,
  updateRescueCompanyManager,
  auditRescueCompanyManager,
  auditRescueCompanyDriver,
  getRescueEmployeeById,
  removeRescueEmployee,
  deleteSingleRescueEmployee
}
